import React, { Component } from 'react';
import { Swiper } from 'antd-mobile'
import { get_swiper } from '../utils/api'

class Swipere extends Component {
    state = {
        banner: []
    }
    componentDidMount() {//发送请求
        get_swiper().then((res) => {
            this.setState({
                // console.log(res.data);
                banner: res.data.list
            })
        })
    }
    render() {
        return (
            <Swiper autoplay loop>
                {
                    this.state.banner.map((item, index) => (
                        <Swiper.Item key={index}>
                             <img src= {item.pic} alt=""/>
                        </Swiper.Item>
                    ))
                }
            </Swiper>

        );
    }
}

export default Swipere;